//===============================================================================
 // Microsoft Architecture Strategy Team
 // LitwareHR - SaaS Sample Application
//===============================================================================
 // Copyright  Microsoft Corporation.  All rights reserved.
 // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
 // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
 // LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 // FITNESS FOR A PARTICULAR PURPOSE.
 //===============================================================================
 // The example companies, organizations, products, domain names,
 // e-mail addresses, logos, people, places, and events depicted
 // herein are fictitious.  No association with any real company,
 // organization, product, domain name, email address, logo, person,
 // places, or events is intended or should be inferred.
 //===============================================================================

using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;

using LitwareHR.Recruiting.Contract;
using LitwareHR.Recruiting.Workflows.Activities;
using Shp.Runtime.Contract;

namespace LitwareHR.Recruiting.Workflows
{
    public partial class RecruitingProcess : StateMachineWorkflowActivity
    {

        private string _applicantUsername;

        private Guid _positionId;

        private Guid _targetEvaluationProcess;
        private Guid _tenantId;

        private Position _position;

        public string ApplicantUsername
        {
            get {return _applicantUsername; }
            set {_applicantUsername = value; }
        }

        public Guid PositionId
        {
            get {return _positionId; }
            set {_positionId = value; }
        }

        public Guid TargetEvaluationProcess
        {
            get {return _targetEvaluationProcess; }
            set {_targetEvaluationProcess = value; }
        }

        public Guid TenantId
        {
            get {return _tenantId; }
            set {_tenantId = value; }
        }

        public Position Position
        {
            get { return _position; }
            set { _position = value; }
        }
	

        private void OnResumeSubmitted(object sender, ExternalDataEventArgs e)
        {
            _applicantUsername = ((ResumeSubmittedEventArgs)e).Identity;
        }

        private void SetNewWorkflowParameters(object sender, EventArgs e)
        {
            (sender as WorkflowFactoryActivity).InstanceId = Guid.NewGuid();
            (sender as WorkflowFactoryActivity).Parameters.Add("ApplicantUsername", _applicantUsername);
            (sender as WorkflowFactoryActivity).Parameters.Add("RecruitingWorkflowId", this.WorkflowInstanceId);
            (sender as WorkflowFactoryActivity).Parameters.Add("TenantId", this.TenantId);
        }

    }

}
